<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function array(){
      let arr = [2,89,108,42,77,10,1,888]
      let max = arr[0]
      let min = arr[0]
      let sum = 0
      for(let i = 0;i<= arr.length-1;i++){
        max = max > arr[i] ? max:arr[i]
        min = min > arr[i] ? arr[i]: min
        sum += arr[i]
      }
      document.write(`最大数为${max}<br>`)
      document.write(`最小数为${min}<br>`)
      document.write(`和为${sum / arr.length}`)
      console.log(arr.length);
    }
    array()
  </script>
</body>
</html>